package com.itheima.exer.exercise.ex0927;

import java.util.ArrayList;
import java.util.List;

public class MyArrayListTest {
    public static void main(String[] args) {
        List<String> ls = new ArrayList<>();
        ls.add("Java");
        ls.add("JavaSE");
        ls.add("JavaEE");
        ls.add(3,"JavaME");
        System.out.println(ls);
        //删除元素:
        boolean javaME = ls.remove("JavaME");
        System.out.println("JavaME删除成功了吗?"+javaME);
        String remove = ls.remove(1);
        System.out.println("删除索引为1的元素为:"+remove);
        System.out.println(ls);
        //修改元素:
        String python = ls.set(0, "Python");
        System.out.println("被Python替换掉的0索引的元素为:"+python);
        System.out.println(ls);
        //获取元素:
        String s = ls.get(0);
        System.out.println("获取到0索引的位置的元素为:"+s);
        for (int i = 0; i < ls.size(); i++) {
            System.out.println(ls.get(i));
        }
    }
}
